package cc.vv.btpartyjob.partyservice.adapter

import android.annotation.SuppressLint
import android.text.TextUtils
import android.widget.TextView
import cc.vv.baselibrary.adapter.SimpleCommonAdapter
import cc.vv.baselibrary.adapter.holder.ExtendViewHolder
import cc.vv.baselibrary.util.HtmlFilterUtil
import cc.vv.btpartyjob.jnimodule.server.OperationServer
import cc.vv.btpartyjob.partyservice.R
import cc.vv.btpartyjob.partyservice.module.bean.ResourceBean

/**
 * 资源清单adapter
 * Created by Chen.qi on 2018/10/24.
 */
class ResourceAdapter(layoutResId: Int) : SimpleCommonAdapter<ResourceBean>(layoutResId) {
    @SuppressLint("SetTextI18n")
    override fun convert(helper: ExtendViewHolder, item: ResourceBean, position: Int) {
        //资源名称
        helper.getView<TextView>(R.id.tv_irl_projectName)?.text = item.resourceType

        //数量
        helper.getView<TextView>(R.id.tv_irl_number)?.text = "数量：${item.num}"

        //时间段
        helper.getView<TextView>(R.id.tv_irl_timeQuantum)?.text =
                "时间段：${OperationServer.formatStr(item.startTime)} " +
                        "至${OperationServer.formatStr(item.endTime)}"

        //详细内容
        helper.getView<TextView>(R.id.tv_irl_contentDetail)?.text = HtmlFilterUtil.delHTMLTag(item.conetnt)

        //所属单位
        helper.getView<TextView>(R.id.tv_irl_status)?.text = item.unitName
    }
}